import React, { useState } from 'react'
import A from './components/A'
import B from './components/B'

export default function App() {
    let [count, setCount] = useState(1)
    return (
        <div>
            <p><button onClick={()=>{
                setCount(count+1)
            }}>count++</button></p>
            <h3>渲染不同的元素，重新渲染</h3>
            {count % 2 == 1 ? <span>span</span> : <p>p标签</p>}

            <hr />
            <h3>渲染相同的元素,标签复用，只改内容和属性</h3>
            {count % 2 === 1 ? <p username="lz">p1</p> : <p username="ll">p2</p>}

            <hr />
            <h3>不同的组件, 重新渲染</h3>
            {count % 2 ? <A/> : <B/>}
        </div>
    )
}
